package cn.skcks.controller;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class HelloController implements Controller {
	public ModelAndView handleRequest(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
		// ModelAndView 模型和视图
		ModelAndView modelAndView = new ModelAndView();

		// 调用业务层

		// 封装对象 放在 ModelAndView 中   Model
		modelAndView.addObject("msg","Hello SpringMVC!");

		// 封装要跳转的视图 放在 ModelAndView 中   View
		// 实际路径 /WEB-INF/jsp/hello.jsp
		modelAndView.setViewName("hello");

		return modelAndView;
	}
}